home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Best of MacTutor - S…e Code for Volumes 1 to 5
/
The Best of MacTutor - Source Code for Volume 1-5 (Wayzata Technology)(6031)(1990).bin
/
Source Code
/
#05 (Dec85-Jan86)
/
pascal
/
Christmas Graphics 1-13
/
VBLExample.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1985-10-11
|
2KB
|
93 lines
program VBLExample;{ file VBLExample.pas }
{ $I=Include these interface files }
(*$I MemTypes.ipas *)
(*$I QuickDraw.ipas *)
(*$I OSIntf.ipas *)
(*$I ToolIntf.ipas *)
{ We will convert this code with Rmaker in
such a way as to cause execution to begin
with the FIRST PROCEDURE, and not in the
main procedure. }
TYPE
GlobalDataP=^GlobalData;
GlobalData=record
vblPart:VBLTask;
count:longint;
end;{ 18 bytes long }
{ var
no global variables allowed }
{ the following four procs don't generate code now }
Procedure SetA0(a0:longint);inline $205F;{ MOVE.l (SP)+,A0 }
Procedure Vinstall_Trap;inline $A033;{ _Vinstall trap }
Function GetGlobalData : GlobalDataP;FORWARD;
Procedure VBLScreenTask;FORWARD;
{ execution begins here }
{ We install VBLScreenTask in the VBL queue and
set up the body of the dummy procedure as our
data record. }
Procedure InstallVBLTask;{ one time setup routine }
var
cp : GlobalDataP;
begin
cp := GetGlobalData;
cp^.count:=0;
with cp^.VBLPart do
begin
qType:=ord(vType);
vblAddr:=@VBLScreenTask;
vblCount:=1;
vblPhase:=0;
{ This funky double step is my way of calling Vinstall
without having to link with another file. Register A0
is set and then the trap is called. }
SetA0(ord(@cp^.VBLPart));
Vinstall_Trap;
end;
end;
Procedure Dummy;{ reserve some bytes in the code space }
begin
Dummy; Dummy; Dummy; Dummy;{ 8 bytes }
Dummy; Dummy; Dummy; Dummy;{ 8 bytes }
Dummy;
end;
Function GetGlobalData {: GlobalDataP};
begin
GetGlobalData := pointer(ord(@Dummy));
end;
{ Reset the VBLCount so we remain in queue and
utilise $824 (SCRNBASE global) to find address
of the screen and write the count there. }
Procedure VBLScreenTask;
var
cp : GlobalDataP;
ScreenP:^longint;
begin
ScreenP:=pointer($824);
ScreenP:=pointer(ScreenP^);
cp:=GetGlobalData;
with cp^ do
begin
count:=count+1;
with VBLpart do
begin
VBLCount:=1;
ScreenP^:=count;
end;
end;
end;{ vbltask }
begin{ main }
{ ¡¡¡ main procedure not used !!! }
end.